package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface BrandMapper extends Mapper<Brand> {

    /**
     * 根据分类名称查询品牌信息
     * @param categoryName
     * @return
     */
    @Select("SELECT\n" +
            "\tt3.NAME,\n" +
            "\tt3.image \n" +
            "FROM\n" +
            "\ttb_category t1,\n" +
            "\ttb_category_brand t2,\n" +
            "\ttb_brand t3 \n" +
            "WHERE\n" +
            "\tt1.`name` = #{name} \n" +
            "\tAND t1.id = t2.category_id \n" +
            "\tAND t2.brand_id = t3.id")
    List<Map> findListByCategoryName(@Param("name") String categoryName);



}
